/*
  reflect  静态类  Math就是静态类
    -封装了一系列对对象底层的操作 13个方法 对应proxy劫持的对象属性
    -reflect 成员方法就是proxy处理对象的默认实现  
    -统一提供了一套用于操作对象的api
*/
const person = {
  name: "caozy",
  age: 18,
};
const personProxy = new Proxy(person, {
  get(target, property) {
    return Reflect.get(target, property);
  },
  //   get(target, property) {
  //     // return 100;
  //     return property in target ? target[property] : "default";
  //   },
  //   set(target, property, value) {
  //     console.log(target, property, value);
  //     target[property] = value;
  //   },
  //   deleteProperty(target, property) {
  //     console.log("delete", property);
  //     delete target[property];
  //   },
});
// console.log("name" in person);
// console.log(delete person["name"]);
// console.log(Object.keys(person));
//建议这么写
console.log(Reflect.has(person, "name"));
console.log(Reflect.deleteProperty(person, "age"));
console.log(Reflect.ownKeys(person));
